<?php
	require_once("conexion/conexion.php");
	
	if(isset($_POST['campo']) and isset($_POST['orden']))
	{
		$campo=$_POST['campo'];
		$orden=$_POST['orden'];
	}
	else
	{
		//por defecto
		$campo='NNombre';
		$orden='ASC';
	}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Documento sin t&iacute;tulo</title>
<link href="Estilos/global.css" rel="stylesheet" type="text/css" />
<link href="Estilos/local.css" rel="stylesheet" type="text/css" />
<link href="Estilos/CssTabla3.css" rel="stylesheet" type="text/css" />

<script src="include_js/jquery.js" type="text/javascript"></script>
<script>
function EditarStock(valor)
{
	patente = document.getElementById("tbBodega").rows[valor].cells[0].innerText;
	//alert(rut);
	$.ajax({
				type: 'POST',
				url: '../Editar/Carga_Editar_Camion.php',
				data: {patente:patente},
				success: function(data) {
					$('#tabla').html(data);
				}
			})
}

function Direccionar2()
{
	//alert('dir');
		$.ajax({
				type: 'POST',
				url: '../ConfiguracionSistema/Tabla_Camion.php',
				data: $('#analisis').serialize(),
				success: function(data) {
					$('#tabla').html(data);
				}
			})
}

function Eliminar(valor)
{
	rut = document.getElementById("tbBodega").rows[valor].cells[0].innerText;
	
		$.ajax({
					type: 'POST',
					url: '../Editar/Eliminar_Camion.php',
					data: {rut:rut},
					success: function(data) {
						$('#eliminar').html(data);
						Direccionar2();
					}
				})
}

function OrdenarPor(campo, orden)
{
	$.ajax({
				type: 'POST',
				url: '../ConfiguracionSistema/Tabla_RepAcc.php',
				data: {campo:campo,orden:orden},
				success: function(data) {
					$('#tabla').html(data);
				}
			})
}
</script>
</head>

<body>
<form name="analisis" id="analisis" method="post">
<?php
		$con = new Conexion();
		$con2 = $con->conexionBD("maryun");
		$sql="select 
					ProCod,
					ProNombre
					
					from Producto";
		$res= mysql_query($sql) or die ($con->error_mysql("Error en la consulta".mysql_error()));
		$con->cerrarBD();
?>
<a name="abajo"></a>
<div style="height:5px"></div>
<div class='option2'><div style="float:left"><label style="font:Verdana, Arial, Helvetica, sans-serif; color:#0066CC; font-weight:bold;">Productos Ingresados.</label></div><div style="float:right;"><img src="../imagen/cerrar.png" width="16" height="16" onclick="CerrarDatos();" style="cursor: pointer; border: 1px solid #990000;" alt="Cerrar" /></div><div style="clear:both"></div></div>

  <div class="cabecera2">
   <table class="fija" border="0" cellpadding="0" cellspacing="0" id="tbBodega">
      <thead class="fija">
      	<tr class="fija">
      	    <th width="10%" class="fija">codigo</th>
			<th width="24%" class="fija">nombre</th>
			<th width="8%" class="fija" colspan="2">acci&Oacute;n</th>
      	</tr>
      </thead>
      <tbody class="fija">
         <tr class="fija"><td colspan="4" class="fija">&nbsp;</td></tr>
		 <tr class="fija"><td colspan="4" class="fija">&nbsp;</td></tr>
	</tbody>
		<?php
	$aux = 2;
	while($reg = mysql_fetch_array($res))
	{
			if(($aux % 2)==0)
			{
				echo "<tr class='filaImpar' id='".$aux."'>";
				echo "<td width=\"10%\" style='text-align:left;'>".$reg['ProCod']."</td>";
				echo "<td width=\"24%\" style='text-align:left;'>".$reg['ProNombre']."</td>";
				echo "<td style='text-align:center'><img src='imagen/edit_icon.gif' width='16' height='16' alt='Editar' style='cursor: pointer;' onclick='EditarStock($reg['ProCod']);'/></td>";
				echo "<td style='text-align:center'><img src='imagen/delete_icon.gif' width='16' height='16' alt='Eliminar' style='cursor: pointer;' onclick='Eliminar($reg['ProCod']);'/></td>";
				echo "</tr>";
			}
			else
			{
				echo "<tr class='filaPar' id='".$aux."'>";
				echo "<td width=\"10%\" style='text-align:left;'>".$reg['NCod']."</td>";
				echo "<td width=\"10%\" style='text-align:left;'>".$reg['ProCod']."</td>";
				echo "<td width=\"24%\" style='text-align:left;'>".$reg['ProNombre']."</td>";
				echo "<td style='text-align:center'><img src='imagen/edit_icon.gif' width='16' height='16' alt='Editar' style='cursor: pointer;' onclick='EditarStock($reg['ProCod']);'/></td>";
				echo "<td style='text-align:center'><img src='imagen/delete_icon.gif' width='16' height='16' alt='Eliminar' style='cursor: pointer;' onclick='Eliminar($reg['ProCod']);'/></td>";
				echo "</tr>";
			}
			$aux++;
	}
	?>
      
   </table>     
</div>
<div id="eliminar"></div>
</form>
</body>
</html>
